#ifndef BE_SHADER_H_INCLUDED
#define BE_SHADER_H_INCLUDED

#include <GL/glew.h>
#include "be_graphics_kernel.h"

#include <cstdio>
#include <cassert>
#include <string>

class BeShader
{
public:
	BeShader(const GLenum shaderType);
	virtual ~BeShader();
	GLuint handle() const { return m_handle; }
	void source(const GLsizei count, const GLchar ** const strings, const GLint* const lengths);
	void source(const GLchar *string, const GLint* const length);
	void source(const GLchar *string);
	void source(const std::string& string);
	void compile();
private:
	BeGraphicsKernel	m_graphicsKernel;
	GLuint				m_handle;
};

class BeVertexShader : public BeShader
{
public:
	BeVertexShader() : BeShader(GL_VERTEX_SHADER) {}
};

class BeFragmentShader : public BeShader
{
public:
	BeFragmentShader() : BeShader(GL_FRAGMENT_SHADER) {}
};

class BeProgram
{
public:
	BeProgram();
	~BeProgram();
	void attachShader(BeShader* const shader);
	void link();
	GLuint handle() const { return m_handle; }
private:
	BeGraphicsKernel	m_graphicsKernel;
	GLuint				m_handle;
};

#endif
